layui.use(['table', 'layer'], function() {
	var $ = layui.$;
	var table = layui.table;
	var layer = layui.layer;
	var url = location.href;
	var paraString = url.substring(url.indexOf("?") + 1, url.length).split("&");
	var id = paraString[0].substring(paraString[0].indexOf("=") + 1, paraString[0].length);
	var type = paraString[1].substring(paraString[1].indexOf("=") + 1, paraString[1].length);
	if(type=='edit'){
		noreadonly();
		ordermsg();
	}else if(type=='detail'){
		readonly();
		ordermsg();
	}else if(type=='add'){
		
	}
	function ordermsg(){
		$.ajax({
			type:"post",
			url:"/order/msg",
			async:true,
			data:{
				id:id
			},
			success:function(data){
				var result=JSON.parse(data.message);
				$(".orderman").val(result.orderman);
				$(".ordernumber").val(result.ordernumber);
				$(".ordercontxt").val(result.ordercontxt);
				$(".ordertime").val(result.ordertime);
				$(".orderdate").val(result.orderdate);
				$(".state").val(result.state);
			}
		});
	}
	function readonly(){
		$(".orderman").attr("readonly","readonly");
		$(".ordernumber").attr("readonly","readonly");
		$(".ordercontxt").attr("readonly","readonly");
		$(".state").attr("readonly","readonly");
	}
	function noreadonly(){
		$(".orderman").removeAttr("readonly");
		$(".ordernumber").removeAttr("readonly");
		$(".ordercontxt").removeAttr("readonly");
		$(".state").removeAttr("readonly");
	}
});